package com.cloud.logger.zchain.adapter.http;

import com.cloud.logger.zchain.core.ChainNode;
import com.cloud.logger.zchain.core.IClientRequestAdapter;
import com.cloud.logger.zchain.core.IdConversion;

import javax.servlet.http.HttpServletResponse;

/**
 * User: wcy
 * Date: 2017/11/15
 * Time: 19:53
 */
public class HttpClientRequestAdapter implements IClientRequestAdapter {

    private HttpServletResponse response;

    public String getNodeName() {
        return null;
    }

    public void addChainNodeToRequest(ChainNode chainNode) {
        response.addHeader(AdapterHttpHeaders.RootId.getName(), chainNode.rootIdString());
        response.addHeader(AdapterHttpHeaders.NodeId.getName(), chainNode.nodeId);
        if (chainNode.nullableParentId() != null) {
            response.addHeader(AdapterHttpHeaders.ParentNodeId.getName(), chainNode.parentId);
        }
    }
}
